package com.mvp.images;

import android.text.TextUtils;


/**
 * Created by zhangyuncai on 2018/9/11.
 */
public class ImageHelper {


    public static final String HTTP0 = "https:";
    public static final String HTTP = "http://";
    public static final String HTTPS = "https://";
    public static final String FILE = "file://";
    public static final String SD_CARD = "/storage";

    public static String addImageDomain(String url) {
        if (TextUtils.isEmpty(url)) {
            return "";
        }
        if (url.startsWith(HTTP) || url.startsWith(HTTPS) || url.startsWith(FILE) || url.startsWith(SD_CARD)) {
            return url;
        }
        if (url.startsWith("//")) {
            return HTTP0 + url;
        }
        return HTTP + url;
    }

}
